package s1.s1_5.ariprog;

import java.io.*;

/*
ID: huangmingbo
LANG: JAVA
TASK: ariprog
 */
public class ariprog {
    public static void main(String[] args) throws IOException {
        try (
                BufferedReader reader = new BufferedReader(new InputStreamReader(ariprog.class.getResourceAsStream(ariprog.class.getSimpleName() + ".in")));
                PrintWriter writer = new PrintWriter(new FileWriter(ariprog.class.getSimpleName() + ".out"));
        ) {

            int N = Integer.parseInt(reader.readLine());
            int M = Integer.parseInt(reader.readLine());
            int max = M * M * 2 + 1;
            boolean[] idxs = new boolean[max];
            int[] x = new int[max];
            int[] y = new int[max];
            for (int i = 0; i <= M; i++) {
                for (int j = i; j <= M; j++) {
                    idxs[i * i + j * j] = true;
                    x[i * i + j * j] = i;
                    y[i * i + j * j] = j;
                }
            }

            int a = 0;
            int b = 1;
            int n = N - 1;
            boolean found;
            boolean ret = false;
            while (a + n * b < max) {

                found = true;
                for (int i = 1; i <= n; i++) {
                    if (!idxs[a + i * b]) {
                        found = false;
                        break;
                    }
                }

                if (found) {
                    writer.println(a + " " + b);
                    for (int i = 0; i <= n; i++) {
                        writer.print((a + i * b) + " ");
                    }
                    writer.println();
                    for (int i = 0; i <= n; i++) {
                        writer.print(x[a + i * b] + ","+y[a+i*b]+" ");
                    }
                    writer.println();

                    ret = true;
                }

                a++;
                while (a + n * b < max && !idxs[a]) {
                    a++;
                }

                if (a + n * b >= max) {
                    b++;
                    a = 0;
                }
            }

            if (!ret) {
                writer.println("NONE");
            }
            writer.println("--------------------------");

            for (int i = 0; i < idxs.length; i++) {
                if (idxs[i]) {
                    writer.println(i);
                }
            }


        }
    }
}
